HARPA.AI
LIBRARYAPIGUIDESAI COMMANDSBLOG

📥  Video Downloader | MP4 & MP3

Download the video or audio by entering the video link or the TITLE of the YouTube video! You can choose between audio, video and muted video!

Created by Morteza
Updated on Jan 28, 20:20
Installed 25 times
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- type: ask
  param: linkName
  message: 'Please provide the YouTube URL or video title:'
  options: null
  default: ''
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  label: URL OR TITLE INPUT
  optionsInvalid: false
- type: ask
  param: type
  message: Do you want to download the audio or the video?
  options:
    - label: 🎞️ VIDEO
      value: video
    - label: 🔊 AUDIO
      value: audio
    - label: 🔇 MUTED VIDEO
      value: muted video
  default: ''
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  optionsInvalid: false
  label: FILE TYPE
- type: group
  steps:
    - type: calc
      func: set
      param: url
      format: ''
      value: '{{linkName}}'
      label: SET URL
    - type: navigate
      url: https://cobalt.tools/?u={{url}}
      waitForIdle: true
      silent: true
      onFailure: CLICK ON CONTINUE
    - type: group
      steps:
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-auto
                - $class: button
                - $attribute: aria-pressed=false
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: auto
                - $role: listbox
                  traverse: '0'
                - $class: switcher
                  traverse: '0'
                - $class: switcher-parent
                  traverse: '0:0'
                - $id: action-container
                  traverse: '0:0:0'
                - $id: omnibox
                  traverse: '1:0:0:0'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '1:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:0'
                - $anchor: audio
                  shift: '-92:0'
                - $text: audio
                  traverse: '-1:0'
                - $anchor: mute
                  shift: '-184:0'
                - $text: mute
                  traverse: '-1:0'
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 0
            value: auto
          condition: '{{type}} = video'
          label: VIDEO TYPE
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-audio
                - $class: button
                - $attribute: aria-pressed=false
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: audio
                - $role: listbox
                  traverse: '1'
                - $class: switcher
                  traverse: '1'
                - $class: switcher-parent
                  traverse: '0:1'
                - $id: action-container
                  traverse: '0:0:1'
                - $id: omnibox
                  traverse: '1:0:0:1'
                - $anchor: auto
                  shift: '92:0'
                - $text: auto
                  traverse: '-1:1'
                - $anchor: mute
                  shift: '-92:0'
                - $text: mute
                  traverse: '-1:1'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '93:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:1'
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 2
            value: audio
          condition: '{{type}} = audio'
          label: AUDIO TYPE
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-mute
                - $class: button
                - $class: active
                - $attribute: aria-pressed=true
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: mute
                - $role: listbox
                  traverse: '2'
                - $class: switcher
                  traverse: '2'
                - $class: switcher-parent
                  traverse: '0:2'
                - $id: action-container
                  traverse: '0:0:2'
                - $id: omnibox
                  traverse: '1:0:0:2'
                - $anchor: audio
                  shift: '92:0'
                - $text: audio
                  traverse: '-1:2'
                - $anchor: auto
                  shift: '184:0'
                - $text: auto
                  traverse: '-1:2'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '185:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:2'
              min: 5
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 1
            value: mute
          condition: '{{type}} = muted video'
          label: MUTE TYPE
          silent: true
      label: FILE TYPE
    - type: wait
      for: custom-delay
      label: WAIT FOR BYPASS CLOUDFARE PROTECTION
      silent: true
      delay: '4000'
    - type: click
      selectorType: ai
      selector:
        - $matches:
            - $tag: BUTTON
            - $role: button
            - $id: download-button
            - $class: svelte-m5le8h
            - $attribute: aria-label=download
            - $style: '"IBM Plex Mono":14.5px:500:normal'
            - $content: '>>'
            - $id: input-container
              traverse: '3'
            - $class: downloadable
              traverse: '3'
            - $id: download-state
              traverse: '-1'
            - $id: omnibox
              traverse: '0:3'
            - $id: cobalt-save
              traverse: '1:0:3'
            - $anchor: paste
              shift: 11:-55
            - $text: paste
              traverse: '-3:0:3'
            - $anchor: mute
              shift: 388:-52
            - $text: mute
              traverse: '-4:0:3'
            - $anchor: audio
              shift: 480:-52
            - $text: audio
              traverse: '-4:0:3'
          min: 6
        - $size: 1
      item:
        type: element
        container:
          __$ht: element
          id: 0
        value: '>>'
      label: CLICK ON CONTINUE
      silent: true
    - type: wait
      for: custom-delay
      label: WAIT FOR "DOWNLOAD" BUTTON
      silent: true
      delay: '1500'
    - type: click
      selectorType: ai
      selector:
        - $matches:
            - $tag: path
            - $attribute: d=M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2
            - $style: '"IBM Plex Mono":14.5px:500:normal'
            - $id: button-save-download
              traverse: '0:0'
            - $class: action-buttons
              traverse: '0:0:0'
            - $class: dialog-inner-container
              traverse: '1:0:0:0'
            - $class: dialog-body
              traverse: '1:1:0:0:0'
            - $class: popup-body
              traverse: '1:1:0:0:0'
            - $anchor: choose how to save
              shift: '23:58'
            - $text: choose how to save
              traverse: '-2:1:0:0:0'
            - $anchor: >-
                cobalt tried saving the file automatically, but your browser
                stopped it. you have to select a preferred method manually.
              shift: 50:-51
            - $text: >-
                cobalt tried saving the file automatically, but your browser
                stopped it. you have to select a preferred method manually.
              traverse: '-1:1:0:0:0'
            - $anchor: share
              shift: '-115:14'
            - $text: share
              traverse: '-1:0:0:0'
          min: 5
        - $size: 1
      item:
        type: element
        container:
          __$ht: element
          id: 0
        value: Element
      label: CLICK ON DOWNLOAD
      silent: true
    - type: jump
      to: URL OR TITLE INPUT
  condition: >-
    {{linkName}} =~
    https?:\/\/(?:www\.)?(?:bluesky\.com|dailymotion\.com|facebook\.com|instagram\.com|loom\.com|ok\.ru|pinterest\.com|reddit\.com|rutube\.ru|snapchat\.com|soundcloud\.com|streamable\.com|tiktok\.com|tumblr\.com|twitch\.tv|twitter\.com|vimeo\.com|vk\.com|youtube\.com|youtu\.be)\/?[^\s]+
  label: DOWNLOAD BY LINK
- type: group
  steps:
    - type: calc
      func: set
      param: downloader.site
      format: ''
      value: https://cobalt.tools
    - type: navigate
      url: https://www.youtube.com/results?search_query={{linkName}}
      waitForIdle: true
      silent: true
      onFailure: SET URL
    - type: js
      args: linkName
      code: |-
        try {
            const searchTerm = args['linkName'].toLowerCase();
            const links = Array.from(document.querySelectorAll('a[href*="/watch?v="]'));
            let bestMatch = { score: 0, url: false };

            for (const link of links) {
                const title = (link.getAttribute('title') || link.innerText || '').toLowerCase();
                
                // Überspringe leere Titel
                if (!title) continue;
                
                // Berechne Übereinstimmung
                if (title.includes(searchTerm)) {
                    const score = title.split(searchTerm).length - 1;
                    if (score > bestMatch.score) {
                        const videoId = link.href.match(/[?&]v=([^&]+)/)?.[1];
                        if (videoId) {
                            bestMatch = {
                                score: score,
                                url: 'https://www.youtube.com/watch?v=' + videoId
                            };
                        }
                    }
                }
            }

            // Gib die URL zurück oder nimm den ersten Link wenn kein Match
            if (!bestMatch.url && links.length > 0) {
                const firstVideoId = links[0].href.match(/[?&]v=([^&]+)/)?.[1];
                if (firstVideoId) {
                    return 'https://www.youtube.com/watch?v=' + firstVideoId;
                }
            }

            return bestMatch.url || false;

        } catch (error) {
            return false;
        }
      param: bestMatch.url
      timeout: 15000
      onFailure: CLICK "DOWNLOAD"
      label: EXTRACT TITLE MATCH URL
      silent: true
    - type: calc
      func: set
      param: url
      format: ''
      value: '{{bestMatch.url}}'
      label: SET URL
    - type: navigate
      url: https://cobalt.tools/?u={{url}}
      waitForIdle: true
      silent: true
      onFailure: CLICK ON CONTINUE
    - type: group
      steps:
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-auto
                - $class: button
                - $attribute: aria-pressed=false
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: auto
                - $role: listbox
                  traverse: '0'
                - $class: switcher
                  traverse: '0'
                - $class: switcher-parent
                  traverse: '0:0'
                - $id: action-container
                  traverse: '0:0:0'
                - $id: omnibox
                  traverse: '1:0:0:0'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '1:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:0'
                - $anchor: audio
                  shift: '-92:0'
                - $text: audio
                  traverse: '-1:0'
                - $anchor: mute
                  shift: '-184:0'
                - $text: mute
                  traverse: '-1:0'
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 0
            value: auto
          condition: '{{type}} = video'
          label: VIDEO TYPE
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-audio
                - $class: button
                - $attribute: aria-pressed=false
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: audio
                - $role: listbox
                  traverse: '1'
                - $class: switcher
                  traverse: '1'
                - $class: switcher-parent
                  traverse: '0:1'
                - $id: action-container
                  traverse: '0:0:1'
                - $id: omnibox
                  traverse: '1:0:0:1'
                - $anchor: auto
                  shift: '92:0'
                - $text: auto
                  traverse: '-1:1'
                - $anchor: mute
                  shift: '-92:0'
                - $text: mute
                  traverse: '-1:1'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '93:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:1'
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 2
            value: audio
          condition: '{{type}} = audio'
          label: AUDIO TYPE
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $id: setting-button-save-downloadMode-mute
                - $class: button
                - $class: active
                - $attribute: aria-pressed=true
                - $style: '"IBM Plex Mono":14.5px:500:normal'
                - $content: mute
                - $role: listbox
                  traverse: '2'
                - $class: switcher
                  traverse: '2'
                - $class: switcher-parent
                  traverse: '0:2'
                - $id: action-container
                  traverse: '0:0:2'
                - $id: omnibox
                  traverse: '1:0:0:2'
                - $anchor: audio
                  shift: '92:0'
                - $text: audio
                  traverse: '-1:2'
                - $anchor: auto
                  shift: '184:0'
                - $text: auto
                  traverse: '-1:2'
                - $anchor: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  shift: '185:42'
                - $text: https://www.youtube.com/watch?v=LU1lzWS1GTw&t=45s
                  traverse: '-2:1:0:0:2'
              min: 5
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 1
            value: mute
          condition: '{{type}} = muted video'
          label: MUTE TYPE
          silent: true
      label: FILE TYPE
    - type: wait
      for: custom-delay
      delay: '4000'
      silent: true
      label: WAIT DOWNLOAD BUTTON
    - type: click
      selectorType: ai
      selector:
        - $matches:
            - $tag: BUTTON
            - $role: button
            - $id: download-button
            - $class: svelte-m5le8h
            - $attribute: aria-label=download
            - $style: '"IBM Plex Mono":14.5px:500:normal'
            - $content: '>>'
            - $id: input-container
              traverse: '3'
            - $class: downloadable
              traverse: '3'
            - $id: download-state
              traverse: '-1'
            - $id: omnibox
              traverse: '0:3'
            - $id: cobalt-save
              traverse: '1:0:3'
            - $anchor: paste
              shift: 11:-55
            - $text: paste
              traverse: '-3:0:3'
            - $anchor: mute
              shift: 388:-52
            - $text: mute
              traverse: '-4:0:3'
            - $anchor: audio
              shift: 480:-52
            - $text: audio
              traverse: '-4:0:3'
          min: 6
        - $size: 1
      item:
        type: element
        container:
          __$ht: element
          id: 0
        value: '>>'
      label: CLICK ON CONTINUE
      silent: true
    - type: wait
      for: custom-delay
      delay: '1500'
      silent: true
      label: WAIT DOWNLOAD BUTTON
    - type: click
      selectorType: ai
      selector:
        - $matches:
            - $tag: path
            - $attribute: d=M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2
            - $style: '"IBM Plex Mono":14.5px:500:normal'
            - $id: button-save-download
              traverse: '0:0'
            - $class: action-buttons
              traverse: '0:0:0'
            - $class: dialog-inner-container
              traverse: '1:0:0:0'
            - $class: dialog-body
              traverse: '1:1:0:0:0'
            - $class: popup-body
              traverse: '1:1:0:0:0'
            - $anchor: choose how to save
              shift: '23:58'
            - $text: choose how to save
              traverse: '-2:1:0:0:0'
            - $anchor: >-
                cobalt tried saving the file automatically, but your browser
                stopped it. you have to select a preferred method manually.
              shift: 50:-51
            - $text: >-
                cobalt tried saving the file automatically, but your browser
                stopped it. you have to select a preferred method manually.
              traverse: '-1:1:0:0:0'
            - $anchor: share
              shift: '-115:14'
            - $text: share
              traverse: '-1:0:0:0'
          min: 5
        - $size: 1
      item:
        type: element
        container:
          __$ht: element
          id: 0
        value: Element
      silent: true
      label: CLICK ON DOWNLOAD
    - type: jump
      to: URL OR TITLE INPUT
  label: DOWNLOAD BY NAME | ONLY YOUTUBE
Notice: Please read before using

This automation command is created by a community member. HARPA AI team does not audit community commands.

Please review the command carefully and only install if you trust the creator.

Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy